package com.cjc.config;

import com.cjc.config.interceptor.SaTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web配置拦截
 * @Author: orange
 * @CreateTime: 2025-01-20
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private SaTokenInterceptor saTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry reg) {
       reg.addInterceptor(saTokenInterceptor)
               .addPathPatterns("/**")
               .excludePathPatterns("/user/login")
               .excludePathPatterns("/files/**") ;
    }

}
